#include <stdio.h>

int main(int argc, char *argv[])
{

    int n, m;
    scanf("%d %d", &n, &m);

    int nums[n];
    for (size_t i = 0; i < n; i++)
    {
        scanf("%d", &nums[i]);
    }

    int count = 0;
    int i = 0, z = 0;
    for (i = 0; i < n; i++)
    {
        for (z = 0; z < n; z++)
        {
            if(i!=z){
                if(count < m){
                    printf("%d %d\n", nums[i], nums[z]);
                    count++;
                }else{
                    count = 0;
                    continue;
                }
            }
        }
    }

    return 0;
}